home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / win / wgnuplib.h < prev    next >
C/C++ Source or Header  |  1993-09-15  |  8KB  |  302 lines

  1. /*
  2.  * $Id: wgnuplib.h%v 3.50.1.13 1993/08/19 03:21:26 woo Exp $
  3.  */
  4.  
  5. /* GNUPLOT - win/wgnuplib.h */
  6. /*
  7.  * Copyright (C) 1992   Russell Lang
  8.  *
  9.  * Permission to use, copy, and distribute this software and its
  10.  * documentation for any purpose with or without fee is hereby granted, 
  11.  * provided that the above copyright notice appear in all copies and 
  12.  * that both that copyright notice and this permission notice appear 
  13.  * in supporting documentation.
  14.  *
  15.  * Permission to modify the software is granted, but not the right to
  16.  * distribute the modified code.  Modifications are to be distributed 
  17.  * as patches to released version.
  18.  *  
  19.  * This software is provided "as is" without express or implied warranty.
  20.  * 
  21.  *
  22.  * AUTHORS
  23.  * 
  24.  *   Russell Lang
  25.  * 
  26.  * Send your comments or suggestions to 
  27.  *  info-gnuplot@dartmouth.edu.
  28.  * This is a mailing list; to join it send a note to 
  29.  *  info-gnuplot-request@dartmouth.edu.  
  30.  * Send bug reports to
  31.  *  bug-gnuplot@dartmouth.edu.
  32.  */
  33.  
  34. /* this file contains items to be visible outside wgnuplot.dll */
  35.  
  36. #ifdef _WINDOWS
  37. #define _Windows
  38. #endif
  39.  
  40. #ifdef __DLL__
  41. #define WDPROC WINAPI _export
  42. #else
  43. #define WDPROC WINAPI
  44. #endif
  45.  
  46. #define WGNUPLOTVERSION  "1.1   1993-08-14"
  47. BOOL WDPROC CheckWGNUPLOTVersion(LPSTR str);
  48.  
  49. /* ================================== */
  50. /* For WIN32 API's 
  51. #ifdef WIN32
  52. #define DEFAULT_CHARSET ANSI_CHARSET
  53. #define OFFSETOF(x)  (x)
  54. #define SELECTOROF(x)  (x)
  55. #define MoveTo(hdc,x,y) MoveToEx(hdc,x,y,(LPPOINT)NULL);
  56. #endif
  57.  
  58. /* ================================== */
  59. /* wprinter.c - windows printer routines */
  60. void WDPROC DumpPrinter(HWND hwnd, LPSTR szAppName, LPSTR szFileName);
  61.  
  62. typedef struct tagPRINT {
  63.     HDC        hdcPrn;
  64.     HWND    hDlgPrint;
  65.     BOOL    bUserAbort;
  66.     POINT    pdef;
  67.     POINT    psize;
  68.     POINT    poff;
  69.     struct tagPRINT FAR *next;
  70. } PRINT;
  71. typedef PRINT FAR*  LPPRINT;
  72.  
  73. /* ================================== */
  74. /* wpause.c - pause window structure */
  75. typedef struct tagPW
  76. {
  77.     HINSTANCE    hInstance;        /* required */
  78.     HINSTANCE    hPrevInstance;    /* required */
  79.     LPSTR    Title;            /* required */
  80.     LPSTR    Message;        /* required */
  81.     POINT    Origin;            /* optional */
  82.     HWND    hWndParent;        /* optional */
  83.     HWND    hWndPause;
  84.     HWND    hOK;
  85.     HWND    hCancel;
  86.     BOOL    bPause;
  87.     BOOL    bPauseCancel;
  88.     BOOL    bDefOK;
  89.     WNDPROC    lpfnOK;
  90.     WNDPROC    lpfnCancel;
  91.     WNDPROC    lpfnPauseButtonProc;
  92. } PW;
  93. typedef PW FAR*  LPPW;
  94.  
  95. int WDPROC PauseBox(LPPW lppw);
  96.  
  97. /* ================================== */
  98. /* wmenu.c - menu structure */
  99. #define BUTTONMAX 10
  100. typedef struct tagMW
  101. {
  102.     LPSTR    szMenuName;        /* required */
  103.     HMENU    hMenu;
  104.     BYTE FAR * FAR *macro;
  105.     BYTE FAR *macrobuf;
  106.     int        nCountMenu;
  107.     DLGPROC    lpProcInput;
  108.     char    *szPrompt;
  109.     char    *szAnswer;
  110.     int        nChar;
  111.     int        nButton;
  112.     HWND    hButton[BUTTONMAX];
  113.     int        hButtonID[BUTTONMAX];
  114.     WNDPROC    lpfnMenuButtonProc;
  115.     WNDPROC    lpfnButtonProc[BUTTONMAX];
  116. } MW;
  117. typedef MW FAR * LPMW;
  118.  
  119. /* ================================== */
  120. /* wtext.c text window structure */
  121. /* If an optional item is not specified it must be zero */
  122. #define MAXFONTNAME 80
  123. typedef struct tagTW
  124. {
  125.     LPPRINT    lpr;            /* must be first */
  126.     HINSTANCE hInstance;        /* required */
  127.     HINSTANCE hPrevInstance;    /* required */
  128.     LPSTR    Title;            /* required */
  129.     LPMW    lpmw;            /* optional */
  130.     POINT    ScreenSize;        /* optional */
  131.     unsigned int KeyBufSize;    /* optional */
  132.     LPSTR    IniFile;        /* optional */
  133.     LPSTR    IniSection;        /* optional */
  134.     LPSTR    DragPre;        /* optional */
  135.     LPSTR    DragPost;        /* optional */
  136.     int        nCmdShow;        /* optional */
  137.     FARPROC shutdown;        /* optional */
  138.     HICON    hIcon;            /* optional */
  139.     LPSTR   AboutText;        /* optional */
  140.     HMENU    hPopMenu;
  141.     HWND    hWndText;
  142.     HWND    hWndParent;
  143.     POINT    Origin;
  144.     POINT    Size;
  145.     BYTE FAR *ScreenBuffer;
  146.     BYTE FAR *AttrBuffer;
  147.     BYTE FAR *KeyBuf;
  148.     BYTE FAR *KeyBufIn;
  149.     BYTE FAR *KeyBufOut;
  150.     BYTE    Attr;
  151.     BOOL    bFocus;
  152.     BOOL    bGetCh;
  153.     BOOL    bSysColors;
  154.     HBRUSH    hbrBackground;
  155.     char    fontname[MAXFONTNAME];    /* font name */
  156.     int        fontsize;                /* font size in pts */
  157.     HFONT    hfont;
  158.     int        CharAscent;
  159.     int        ButtonHeight;
  160.     int        CaretHeight;
  161.     int        CursorFlag;
  162.     POINT    CursorPos;
  163.     POINT    ClientSize;
  164.     POINT    CharSize;
  165.     POINT    ScrollPos;
  166.     POINT    ScrollMax;
  167.     POINT    MarkBegin;
  168.     POINT    MarkEnd;
  169.     BOOL    Marking;
  170. } TW;
  171. typedef TW FAR*  LPTW;
  172.  
  173.  
  174. /* ================================== */
  175. /* wtext.c - Text Window */
  176. void WDPROC TextMessage(void);
  177. int WDPROC TextInit(LPTW lptw);
  178. void WDPROC TextClose(LPTW lptw);
  179. void WDPROC TextToCursor(LPTW lptw);
  180. int WDPROC  TextKBHit(LPTW);
  181. int WDPROC TextGetCh(LPTW);
  182. int WDPROC TextGetChE(LPTW);
  183. LPSTR WDPROC TextGetS(LPTW lptw, LPSTR str, unsigned int size);
  184. int WDPROC TextPutCh(LPTW, BYTE);
  185. int WDPROC TextPutS(LPTW lptw, LPSTR str);
  186. void WDPROC TextGotoXY(LPTW lptw, int x, int y);
  187. int  WDPROC TextWhereX(LPTW lptw);
  188. int  WDPROC TextWhereY(LPTW lptw);
  189. void WDPROC TextCursorHeight(LPTW lptw, int height);
  190. void WDPROC TextClearEOL(LPTW lptw);
  191. void WDPROC TextClearEOS(LPTW lptw);
  192. void WDPROC TextInsertLine(LPTW lptw);
  193. void WDPROC TextDeleteLine(LPTW lptw);
  194. void WDPROC TextScrollReverse(LPTW lptw);
  195. void WDPROC TextAttr(LPTW lptw, BYTE attr);
  196. void WDPROC AboutBox(HWND hwnd, LPSTR str);
  197.  
  198. /* ================================== */
  199. /* wgraph.c - graphics window */
  200.  
  201. /* windows data */
  202. #define WGNUMPENS 15
  203.  
  204. #define GWOPMAX 4096
  205. /* GWOP is 8 bytes long. Array of GWOP kept in global block */
  206. struct GWOP {
  207.     WORD op;
  208.     WORD x, y; 
  209.     HLOCAL htext;
  210. };
  211.  
  212. /* memory block for graph operations */
  213. struct GWOPBLK {            /* kept in local memory */
  214.     struct GWOPBLK *next;
  215.     HGLOBAL hblk;            /* handle to a global block */
  216.     struct GWOP FAR *gwop;    /* pointer to global block if locked */
  217.     UINT used;                /* number of GWOP's used */
  218. };
  219.  
  220. /* ops */
  221. #define W_endoflist 0
  222. #define W_dot 10
  223. #define W_diamond 11
  224. #define W_plus 12
  225. #define W_box 13
  226. #define W_cross 14
  227. #define W_triangle 15
  228. #define W_star 16
  229. #define W_move 20
  230. #define W_vect 21
  231. #define W_line_type 22
  232. #define W_put_text 23
  233. #define W_justify 24
  234. #define W_text_angle 25
  235.  
  236. typedef struct tagGW {
  237.     LPPRINT    lpr;            /* must be first */
  238.     HINSTANCE    hInstance;        /* required */
  239.     HINSTANCE    hPrevInstance;    /* required */
  240.     LPSTR    Title;            /* required */
  241.     int        xmax;            /* required */
  242.     int        ymax;            /* required */
  243.     LPTW    lptw;        /* optional */  /* associated text window */
  244.     POINT    Origin;        /* optional */    /* origin of graph window */
  245.     POINT    Size;        /* optional */    /* size of graph window */
  246.     LPSTR    IniFile;    /* optional */
  247.     LPSTR    IniSection;    /* optional */
  248.     HWND    hWndGraph;    /* window handle */
  249.     HMENU    hPopMenu;    /* popup menu */
  250.     int        numsolid;    /* number of solid pen styles */
  251.     int        pen;        /* current pen number */
  252.     int        htic;        /* horizontal size of point symbol (xmax units) */
  253.     int     vtic;        /* vertical size of point symbol (ymax units)*/
  254.     int        hchar;        /* horizontal size of character (xmax units) */
  255.     int        vchar;        /* vertical size of character (ymax units)*/
  256.     int        angle;        /* text angle */
  257.     BOOL    rotate;        /* can text be rotated 90 degrees ? */
  258.     char    fontname[MAXFONTNAME];    /* font name */
  259.     int        fontsize;    /* font size in pts */
  260.     HFONT    hfonth;        /* horizonal font */
  261.     HFONT    hfontv;        /* vertical font */
  262.     BOOL    resized;    /* has graph window been resized? */
  263.     BOOL    graphtotop;    /* bring graph window to top after every plot? */
  264.     BOOL    color;                    /* color pens? */
  265.     HPEN    hbpen;                    /* border pen */
  266.     HPEN    hapen;                    /* axis pen */
  267.     HPEN    hpen[WGNUMPENS];        /* pens */
  268.     LOGPEN    colorpen[WGNUMPENS+2];    /* logical color pens */
  269.     LOGPEN    monopen[WGNUMPENS+2];    /* logical mono pens */
  270.     COLORREF background;            /* background color */
  271.     HBRUSH   hbrush;                /* background brush */
  272.     struct GWOPBLK *gwopblk_head;
  273.     struct GWOPBLK *gwopblk_tail;
  274.     unsigned int nGWOP;
  275.     BOOL    locked;                /* locked if being written */
  276. } GW;
  277. typedef GW FAR*  LPGW;
  278.  
  279. #define WINFONTSIZE 10
  280. #define WIN30FONT "Courier"
  281. #define WINFONT "Arial"
  282.  
  283. #ifndef LEFT
  284. #define LEFT 0
  285. #endif
  286. #ifndef CENTRE
  287. #define CENTRE 1
  288. #endif
  289. #ifndef RIGHT
  290. #define RIGHT 2
  291. #endif
  292.  
  293. void WDPROC GraphInit(LPGW lpgw);
  294. void WDPROC GraphClose(LPGW lpgw);
  295. void WDPROC GraphStart(LPGW lpgw);
  296. void WDPROC GraphEnd(LPGW lpgw);
  297. void WDPROC GraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPSTR str);
  298. void WDPROC GraphPrint(LPGW lpgw);
  299. void WDPROC GraphRedraw(LPGW lpgw);
  300.  
  301. /* ================================== */
  302.